package com.wyix;

import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
 * @author wangdx
 * @since 2025/8/5
 */
public class ButtonTest {
    public static void main(String[] args) {
        Button button = new Button();
        // 伪代码：按钮点击事件（传统方式）
        button.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                try {
                    System.out.println("业务处理");
                } catch (Exception ex) {
                    System.out.println("订单提交失败");
                }
            }
        });

        button.addActionListener(e -> {
            try {
                System.out.println("业务处理");
            } catch (Exception ex) {
                System.out.println("订单提交失败");
            }
        });
    }

}
